﻿using NxChatQQ.Services;
using NxChatQQ.ViewModels;
using NxChatQQ.ViewModels.Components;
using NxChatQQ.ViewModels.Layouts;
using NxChatQQ.ViewModels.Pages;
using NxChatQQ.ViewModels.Settings;
using NxChatQQ.Views;
using NxChatQQ.Views.Components;
using NxChatQQ.Views.Layouts;
using NxChatQQ.Views.Pages;
using NxChatQQ.Views.Settings;
using Prism.Events;
using Prism.Ioc;
using Prism.Unity;
using System.Windows;

namespace NxChatQQ
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<LoginWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {

            // 事件聚合器
            containerRegistry.RegisterSingleton<IEventAggregator, EventAggregator>();
            // 窗口管理器-窗口服务
            containerRegistry.RegisterSingleton<WindowsProviderService>();
            // 弱提示管理器-短提示
            containerRegistry.RegisterSingleton<SimpleSnackbarService>();


            //containerRegistry.RegisterSingleton<ISnackbarService, SimpleSnackbarService>();

            #region 路由管理
            //通过RegisterForNavigation进行手动关联
            containerRegistry.RegisterForNavigation<LoginWindow, LoginWindowViewModel>();
            containerRegistry.RegisterForNavigation<MainWindow, MainWindowViewModel>();
            containerRegistry.RegisterForNavigation<SettingWindow, SettingWindowViewModel>();

            containerRegistry.RegisterForNavigation<ChatMessageLayout, ChatMessageLayoutViewModel>();
            containerRegistry.RegisterForNavigation<RecentListLayout, RecentListLayoutViewModel>();
            containerRegistry.RegisterForNavigation<FriendListLayout, FriendListLayoutViewModel>();
            containerRegistry.RegisterForNavigation<FriendInfoLayout, FriendInfoLayoutViewModel>();
            containerRegistry.RegisterForNavigation<CollectListLayout, CollectListLayoutViewModel>();
            containerRegistry.RegisterForNavigation<CollectContentLayout, CollectContentLayoutViewModel>();

            containerRegistry.RegisterForNavigation<NoticeSettingView, NoticeSettingViewModel>();
            containerRegistry.RegisterForNavigation<NormalSettingView, NormalSettingViewModel>();
            containerRegistry.RegisterForNavigation<ShortcutSettingView, ShortcutSettingViewModel>();
            containerRegistry.RegisterForNavigation<StorageSettingView, StorageSettingViewModel>();
            containerRegistry.RegisterForNavigation<VerifySettingView, VerifySettingViewModel>();
            containerRegistry.RegisterForNavigation<LoginSettingView, LoginSettingViewModel>();
            containerRegistry.RegisterForNavigation<ThemeSettingView, ThemeSettingViewModel>();
            containerRegistry.RegisterForNavigation<AboutSettingView, AboutSettingViewModel>();


            containerRegistry.RegisterForNavigation<CreateGroupView, CreateGroupViewModel>();
            containerRegistry.RegisterForNavigation<QueryFriendView, QueryFriendViewModel>();
            containerRegistry.RegisterForNavigation<HongBaoView, HongBaoViewModel>();


            containerRegistry.RegisterForNavigation<MainPage, MainPageViewModel>();


            #endregion
        }
    }
}
